<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="/billing" prefix="b"%>
<%@page import="com.admin.service.ProvinceService"%>

<%@page import="java.util.List"%>
<%@page import="com.admin.bean.ProvinceCheckedBean"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script type="text/javascript">
<!--
	$(function(){


		$("#update").click(function(){
			
				$.ajax({
					url:"<%=request.getContextPath()%>/admin/sp/update",
					data:$("#spForm").formSerialize(),
					type:"POST",
					success:function(flag){
						if(flag=='1'){
							alert("修改成功!");
							parent.location.reload();
						}else{
							alert("修改失败!");
						}
					}
				});
			
		});
	});

//-->
</script>
</head>
<body>
<div class="information">
	<div class="list">
		<div class="noselect">
			<form action="<%=request.getContextPath() %>/admin/sp/add" method="post" id="spForm">
				<input type="hidden" name="id" id="id" value="${sp.id }">
				<input type="hidden" name="companyid" id="companyid" value="${sp.companyid }">
				<ul>
					<li style="width: 150px;text-align: right;">合作商：</li>
					<li style="width: 300px;text-align: left;">
						${companyBean.companyName }
					</li>
				</ul>
				<ul>
					<li style="width: 150px;text-align: right;">SP名称：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spname" id="spname" value="${sp.spname }" style="width:150px;">
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">业务名称：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spcodename" id="spcodename" style="width:150px;" value="${sp.spcodename }">
					</li>
				</ul>
				<div class="clear"></div>
			
			<ul>
				<li style="width: 150px;text-align: right;">业务线：</li>
				<li style="width: 300px;text-align: left;">
					<select name="bussiness">
						<c:if test="${sp.bussiness == 'SMS'}">
						<option value="SMS" selected="selected">SMS</option>
						</c:if>
						<c:if test="${sp.bussiness != 'SMS'}">
						<option value="SMS">SMS</option>
						</c:if>
						
						<c:if test="${sp.bussiness == 'MMS'}">
						<option value="MMS" selected="selected">MMS</option>
						</c:if>
						<c:if test="${sp.bussiness != 'MMS'}">
						<option value="MMS">MMS</option>
						</c:if>
						
						<c:if test="${sp.bussiness == 'IVR'}">
						<option value="IVR" selected="selected">IVR</option>
						</c:if>
						<c:if test="${sp.bussiness != 'IVR'}">
						<option value="IVR">IVR</option>
						</c:if>
						
						<c:if test="${sp.bussiness == '视频基地'}">
						<option value="视频基地" selected="selected">视频基地</option>
						</c:if>
						<c:if test="${sp.bussiness != '视频基地'}">
						<option value="视频基地">视频基地</option>
						</c:if>
						<c:if test="${sp.bussiness == '百宝箱游戏'}">
						<option value="百宝箱游戏" selected="selected">百宝箱游戏</option>
						</c:if>
						<c:if test="${sp.bussiness != '百宝箱游戏'}">
						<option value="百宝箱游戏">百宝箱游戏</option>
						</c:if>
						
						<c:if test="${sp.bussiness == 'G+游戏'}">
						<option value="G+游戏" selected="selected">G+游戏</option>
						</c:if>
						<c:if test="${sp.bussiness != 'G+游戏'}">
						<option value="G+游戏">G+游戏</option>
						</c:if>
						<c:if test="${sp.bussiness == '动漫基地'}">
						<option value="动漫基地" selected="selected">动漫基地</option>
						</c:if>
						<c:if test="${sp.bussiness != '动漫基地'}">
						<option value="动漫基地">动漫基地</option>
						</c:if>
						
						<c:if test="${sp.bussiness == '阅读基地'}">
						<option value="阅读基地" selected="selected">阅读基地</option>
						</c:if>
						<c:if test="${sp.bussiness != '阅读基地'}">
						<option value="阅读基地">阅读基地</option>
						</c:if>
						
						<c:if test="${sp.bussiness == 'MM基地'}">
						<option value="MM基地" selected="selected">MM基地</option>
						</c:if>
						<c:if test="${sp.bussiness != 'MM基地'}">
						<option value="MM基地">MM基地</option>
						</c:if>
						<c:if test="${sp.bussiness == 'MDO业务'}">
						<option value="MDO业务" selected="selected">MDO业务</option>
						</c:if>
						<c:if test="${sp.bussiness != 'MDO业务'}">
						<option value="MMDO业务">MDO业务</option>
						</c:if>
					</select>
				</li>
			</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">端口：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spcode" id="spcode" value="${sp.spcode }" style="width:150px;">
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">指令：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spcommand" id="spcommand" value="${sp.spcommand }" style="width:150px;">
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">资费：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spfee" id="spfee" size="5" value="${sp.spfee/100 }">元
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">运营商：</li>
					<li style="width: 300px;text-align: left;">
						<select name="spisp" id="spisp" style="width:150px;">
							<c:if test="${sp.spisp == 1}">
							<option value="1">移动</option>
								<option value="2">联通</option>
							</c:if>
							<c:if test="${sp.spisp == 2}">
								<option value="2">联通</option>
								<option value="1">移动</option>
							</c:if>
						</select>
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li></li>
					<li style="width: 150px;text-align: right;">省市：</li>
					<li style="width: 300px;text-align: left;">
					<% List<ProvinceCheckedBean> beanList = (List<ProvinceCheckedBean>)request.getAttribute("list"); %>
							
						<%for(int i = 0;i<beanList.size();i++) {
							ProvinceCheckedBean bean = beanList.get(i);
							if(bean.getStatus() == 1) {%>	
							<input type="checkbox" name="provinceid" value="<%=bean.getId() %>" checked="checked"/><%=bean.getProvince() %>
							
							<%} else if(bean.getStatus()==0) {%>
								<input type="checkbox" name="provinceid" value="<%=bean.getId() %>"/><%=bean.getProvince() %>
							<%} %>
							<%if((i+1)%4==0) {%>
							<br/>
							<%} %>
						<%} %>	
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">屏蔽地市：</li>
					<li style="width: 300px;text-align: left;">
						<textarea rows="5" cols="50" name="shieldcity" id="shieldcity">${sp.shieldcity }</textarea>
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">二次确认：</li>
					<li style="width: 300px;text-align: left;">
						<textarea rows="5" cols="40" name="spmemo" id="spmemo">${sp.spmemo }</textarea>
					</li>
				</ul>	
				
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">SP下行：</li>
					<li style="width: 300px;text-align: left;">
						<textarea rows="5" cols="40" name="spmt" id="spmt">${sp.spmt }</textarea>
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">SP日限：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spdaylimit" id="spdaylimit" size="5" value="${sp.spdaylimit }">
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">SP月限：</li>
					<li style="width: 300px;text-align: left;">
						<input type="text" name="spmonthlimit" id="spmonthlimit" size="5" value="${sp.spmonthlimit }">
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">合作状态</li>
					<li style="width: 300px;text-align: left;">
						<select name="spstatus">
							<c:if test="${sp.spstatus == 1}">
							<option value="1">精确可用</option>
							<option value="2">模糊可用</option>
							<option value="3">精确已分配</option>
							<option value="0">停止</option>
							</c:if>
							<c:if test="${sp.spstatus == 0}">
							<option value="0">停止</option>
							<option value="1">精确可用</option>
							<option value="2">模糊可用</option>
							<option value="3">精确已分配</option>
							</c:if>
							<c:if test="${sp.spstatus == 2}">
							<option value="2">模糊可用</option>
							<option value="0">停止</option>
							<option value="1">精确可用</option>
							<option value="3">精确已分配</option>
							</c:if>
							<c:if test="${sp.spstatus == 3}">
							<option value="3">精确已分配</option>
							<option value="1">精确可用</option>
							<option value="2">模糊可用</option>
							<option value="0">停止</option>
							</c:if>
						</select>
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">备注：</li>
					<li style="width: 300px;text-align: left;">
						<textarea rows="5" cols="40" name="spdesc" id="spdesc">${sp.spdesc }</textarea>
					</li>
				</ul>
				<div class="clear"></div>
				<ul>
					<li style="width: 150px;text-align: right;">&nbsp;</li>
					<li style="width: 300px;text-align: left;">
						<input type="button" id="update" value="修改">
					</li>
				</ul>
			</form>
		</div>
	</div>
</div>
</body>
</html>